package top.ucat.x.service.uaa.server.property;

import lombok.Data;
import org.springframework.beans.factory.BeanClassLoaderAware;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;
import top.ucat.box.starter.dyds.property.MultipleDataSourceProperties;

import java.util.List;
import java.util.Map;

/**
 * @Auther: Jun
 * @Date: 2020/3/24 13:33
 * @Description:
 */
@Component
@Primary
@ConfigurationProperties(
        prefix = "ucat.security.oauth"
)
@Data
public class DynamicSystemLoginProperties implements InitializingBean {
    private List<SystemLoginBo> dynamicLogin;

    public String getSystemLoginCLassPath(String system) {
        SystemLoginBo bo = dynamicLogin.stream().filter(s -> s.getId().equals(system)).findFirst().orElse(null);
        return bo == null ? null : bo.getClassPath();
    }

    @Override
    public void afterPropertiesSet() throws Exception {

    }
}
